-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: add doom loop detection #3445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I don't know if we should do model specific because there are other models too kimi-k2, supernova, gemini models all can get to that state, peoplee can also define model aliases too hard to catch them all. What if we just do a check when a also I think the "error message" should probably be the same for all the llms is there any reason for a different message per model? I don't know if it will matter substantially in this case What do you think? |
…sion-based approach
|
Updated to universal doom loop detection. Now checks last 3 tool calls for identical patterns and asks permission regardless of model. |
|
hm that one is harder to catch, I think this current pr will be a good start and we will see how it performs for other cases |
|
🔥 CRITICAL BUGFIXES: - Fix hanging permission prompts in headless mode (sst#3522) - Add doom loop detection (sst#3445) - Fix MCP metadata preservation (sst#3573) - Fix agent model selection priority (sst#3572) - Fix TUI error display - Fix parcel watcher issue (sst#3544) 🚀 NEW FEATURES: - Add MCP server timeout configuration (sst#3558) - Add positional arguments for slash commands (sst#3456) - Add session ID to agent context metadata (sst#3559) - Add session.started event hook (sst#3413) - Add SNOWCODE_CONFIG_DIR support (rebranded from OPENCODE_CONFIG_DIR) 🔧 IMPROVEMENTS: - Add Zod validation for tool inputs - Fix MCP status() overwrite issue - Add bash timeout validation - Use stdout.write instead of console.log (sst#3508) - Fix SSE buffer overflow (sst#3531) - Make build script cross-platform (sst#3430) 🎨 UX ENHANCEMENTS: - Fix editor paste functionality (sst#3489) - Better frontmatter error messages - Configurable provider timeout (sst#3443) 📝 CHANGES: - 32 files changed, +1,668/-874 lines - Merged from OpenCode production branch (week 44) - Bun version check relaxed to 1.3.x Co-authored-by: OpenCode Contributors




fix: add loop detection for doom loop models (GLM-4.6, Grok Code)
GLM-4.6 and Grok Code models are prone to "doom loops" - infinite repetition of same tool call with identical parameters. This causes wasted tokens, poor user experience with stuck sessions, and server resource waste.
This commit adds targeted loop detection that monitors tool calls for problematic models and injects breaking messages when loops are detected. The implementation uses Map-based counting with O(1) performance and only affects specific models known to have this issue.
Key changes:
DOOM_LOOP_MODELSconstant for model-specific configuration (glm-4.6, grok-code)Fixes infinite loop issue while maintaining performance and extensibility for additional problematic models.
fixes: #3444